package LC;

import java.util.PriorityQueue;

/**
 * @ClassName LC215
 * @Description: TODO
 * @Author hl
 * @Date 2020/10/12
 * @Version V1.0
 **/
public class LC215 {
    public int findKthLargest(int[] nums, int k) {
        PriorityQueue<Integer> queue=new PriorityQueue<>();
        for(int i=0;i<nums.length;i++){
         queue.add(nums[i]);
         if(queue.size()>k){
             queue.poll();
         }
        }
        return  queue.peek();
    }
}
